# Contributor: Anil Madhavapeddy <anil@recoil.org>
# Maintainer: Anil Madhavapeddy <anil@recoil.org>
pkgname=clasp
pkgver=3.3.5
pkgrel=0
pkgdesc="Answer set solver for (extended) normal logic programs"
url="https://potassco.org/"
arch="all"
license="MIT"
makedepends="cmake"
source="https://github.com/potassco/clasp/releases/download/v3.3.5/clasp-$pkgver-source.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCLASP_BUILD_APP=ON \
		-DCLASP_BUILD_TESTS=ON \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		${CMAKE_CROSSOPTS} .
	make
}

check() {
	make test CTEST_OUTPUT_ON_FAILURE=1
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="2b0a877271a92adbb3c16ce0de6b36b9bd5054098e668cee7beb79c4d8eace24a5ecc20e053ba30d8a6b7b0942e229f685b2a71918fe14699a5e1819033b8d79  clasp-3.3.5-source.tar.gz"
